package dongshi.daddy.abstractfactory.factory;

import dongshi.daddy.abstractfactory.product.Brake;
import dongshi.daddy.abstractfactory.product.Wheel;
import dongshi.daddy.abstractfactory.product.car.Car;
import dongshi.daddy.abstractfactory.product.car.CarBrake;
import dongshi.daddy.abstractfactory.product.car.CarWheel;
import org.omg.CosNaming.IstringHelper;

import javax.swing.plaf.nimbus.AbstractRegionPainter;

public class CarFactory extends AbstractFactory<CarBrake, CarWheel, Car> {
    @Override
    protected CarBrake createBrake() {
        return new CarBrake();
    }

    @Override
    protected CarWheel createWheel() {
        return new CarWheel();
    }

    @Override
    public Car createProduct() {
        Brake brake = createBrake();
        brake.brake();
        Wheel wheel = createWheel();
        wheel.run();
        return new Car(brake, wheel);
    }
}
